<html>
<head><meta charset="utf-8"><title>Promotion breaking changes · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html">Promotion breaking changes</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207063973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207063973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207063973">(Aug 16 2020 at 09:47)</a>:</h4>
<p>Over the years, we kept having trouble with promotion again and again. The first I saw is <a href="https://github.com/rust-lang/rust/issues/50814">this soundness issue</a> and since then we kept accumulating special cases in various parts of the compiler. Also see <a href="https://github.com/rust-lang/const-eval/issues/19">why we cannot promote arbitrary <code>const fn</code> calls</a>, and <a href="https://github.com/rust-lang/const-eval/issues/53">this "meta issue"</a>.<br>
I long wanted to restrict promotion to hopefully stop those issues. <span class="user-mention" data-user-id="119009">@eddyb</span>  suggested to only promote expressions that would also be permitted as patterns, but I think that was just based on "these seem like simple expressions". This week I think I finally understood what the underlying property is that makes promotion so problematic: evaluating a promoted can fail, but then we still have to go on with compilation! That's rather nasty as it means every consumer needs to figure out a way to deal with CTFE failure, and go on even though there's no data to go on with. But this means that <code>&amp;(SOME_CONST+15)</code> is fine (it's infallible) even though it is not a pattern, making it more realistic that we could actually achieve this for all editions. It also gives us a clear condition for which functions would be fine to mark with <code>#[rustc_promotable]</code>.</p>
<p>So I think we should work towards making all CTFE failures hard errors, and I started <a href="https://hackmd.io/7DekSpq3R-KgizegdAWO3Q">putting down some notes for that</a>. However, this will require some breaking changes around promotion:</p>
<ul>
<li>We should no longer promote things like <code>&amp;(1/0)</code> or <code>&amp; [2][12]</code>. When promoting fallible operations like division, modulo, and indexing (and I <em>think</em> those are all the fallible operations we promote, but I might have missed something), then we have to make sure that this concrete promoted will not fail -- we need to check for div-by-0 and do the bounds check before accepting an expression for promotion. If that is too breaking, a backup plan might be to somehow treat this more like <code>CheckedAdd</code>, where we promote the addition but not the assertion, which does ensure that the promoted never fails to evaluate even on overflow. (But I think that only works for divison/modulo, where we could return a "dummy value"; it doesn't work for indexing in general.)</li>
<li>We have to <a href="https://github.com/rust-lang/rust/issues/75586">treat <code>const fn</code> like <code>fn</code> for promotion</a>, but I think we have to do that anyway. The fact that we don't is a bug that happened because we never spelled out a design for any of this, so the only way to notice such problems was to look at the code, which not many people did (I did not).</li>
</ul>
<p>In both of these cases, if the user really needs a <code>static</code> lifetime, the fix is to use <a href="https://github.com/rust-lang/rfcs/pull/2920">a const block</a>.</p>
<p>And then there's an orthogonal breaking change that we need to <a href="https://github.com/rust-lang/rust/issues/75556">fix mutable refs in <code>static mut</code></a>.</p>
<p>So, we have three separate breaking changes around promotion, 2 of which are bugfixes that I think we should do anyway. What do you think is the best way to stage this, and what is the right process (RFC or MCP or whatever)?<br>
Cc <span class="user-group-mention" data-user-group-id="1916">@WG-const-eval</span></p>



<a name="207397483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397483">(Aug 19 2020 at 11:48)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> I am supportive of this effort.  We shouldn't get <em>too</em> hung up on procedure, though I think there is an interesting question. If you want to convert the above text into an MCP, that'd be good, and I think we could go forward from there. The real question in my mind is whether you + maybe others are prepared to try and "see it through", presuming you had lang-team support? i.e., do the experiments to define promotion, figure out the impact, author the RFC, and land the change? I think it's about the right size of work that I'd like to see the lang team tracking (similar, to my mind, to things like ffi-unwind and other projects).</p>
<p>It seems like conceptually this also fits into "const evaluation", but partly that's because the const evaluation group is not really tied to a specific project but a bit "higher level".</p>



<a name="207397502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397502">(Aug 19 2020 at 11:49)</a>:</h4>
<p>Also it seems clear that this cannot be done across an edition boundary</p>



<a name="207397757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397757">(Aug 19 2020 at 11:52)</a>:</h4>
<p>Yes I'd be willing to help see this through. I am a bit confused that you first mention an MCP and then an RFC, but either way works for me. ;)</p>
<blockquote>
<p>It seems like conceptually this also fits into "const evaluation"</p>
</blockquote>
<p>Yes I think it does, that's how I am involved in the first place.^^ The main goal of this is to clean up our const evaluation technical debt in the compiler. That's also why editions don't help -- if we have to keep the old code around, not much is won.</p>



<a name="207397803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397803">(Aug 19 2020 at 11:52)</a>:</h4>
<p>Oh, well, MCP is just a mechanism to agree that we want an RFC, essentially</p>



<a name="207397814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397814">(Aug 19 2020 at 11:52)</a>:</h4>
<p>(in lang team, anyway)</p>



<a name="207397818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397818">(Aug 19 2020 at 11:52)</a>:</h4>
<p>oh. different from t-compiler MCP then I guess.</p>



<a name="207397824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397824">(Aug 19 2020 at 11:53)</a>:</h4>
<p>yeah I've been wanting to change the terminology</p>



<a name="207397827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397827">(Aug 19 2020 at 11:53)</a>:</h4>
<p>it's evident that my attempt to unify was a mistake</p>



<a name="207397828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397828">(Aug 19 2020 at 11:53)</a>:</h4>
<p>"project proposal"</p>



<a name="207397841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397841">(Aug 19 2020 at 11:53)</a>:</h4>
<p>(technically, depending on the proposal, it may not require an RFC)</p>



<a name="207397847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397847">(Aug 19 2020 at 11:53)</a>:</h4>
<p>I just think this does require an RFC</p>



<a name="207397856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397856">(Aug 19 2020 at 11:53)</a>:</h4>
<p>both because it's a breaking change and because we should force ourselves to write up the rules/logic</p>



<a name="207397909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397909">(Aug 19 2020 at 11:54)</a>:</h4>
<p>we don't necessarily <em>need</em> an MCP, but it'd be good to file one because then it gets on the lang-team agenda to discuss etc</p>



<a name="207397941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397941">(Aug 19 2020 at 11:54)</a>:</h4>
<p>(but I meant it literally when I said the above text would suffice)</p>



<a name="207397948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207397948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207397948">(Aug 19 2020 at 11:54)</a>:</h4>
<p>okay, fair. I expected this would take a while. part of me wants to rush this to avoid accumulating further incompatible code out there, but that's not really appropriate either. (I don't think there is a good way to do future-incompat warnings here.)</p>



<a name="207398010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398010">(Aug 19 2020 at 11:55)</a>:</h4>
<p>I can put turning the above text into an MCP onto my list. It would help to have an MCP template or examples or so.</p>



<a name="207398140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398140">(Aug 19 2020 at 11:57)</a>:</h4>
<p>one other thing is</p>



<a name="207398152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398152">(Aug 19 2020 at 11:57)</a>:</h4>
<p>there is a template</p>



<a name="207398157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398157">(Aug 19 2020 at 11:57)</a>:</h4>
<p>one sec</p>



<a name="207398176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398176">(Aug 19 2020 at 11:57)</a>:</h4>
<p>actually I already renamed the templaet</p>



<a name="207398178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398178">(Aug 19 2020 at 11:57)</a>:</h4>
<p>to project proposal :)</p>



<a name="207398179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398179">(Aug 19 2020 at 11:57)</a>:</h4>
<p><a href="https://github.com/rust-lang/lang-team/issues/new?assignees=&amp;labels=major-change%2C+T-lang&amp;template=project_proposal.md&amp;title=%28My+project+proposal%29">https://github.com/rust-lang/lang-team/issues/new?assignees=&amp;labels=major-change%2C+T-lang&amp;template=project_proposal.md&amp;title=%28My+project+proposal%29</a></p>



<a name="207398184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398184">(Aug 19 2020 at 11:57)</a>:</h4>
<p>what I was going to say was:</p>



<a name="207398234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398234">(Aug 19 2020 at 11:58)</a>:</h4>
<p>we could move this straight to a charter even, since I would be happy to serve as liaison</p>



<a name="207398246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398246">(Aug 19 2020 at 11:58)</a>:</h4>
<p>but also that once we set it up, we can start landing code, so we could start warnings etc</p>



<a name="207398254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398254">(Aug 19 2020 at 11:58)</a>:</h4>
<p>we'll probably need them anyway I imagine?</p>



<a name="207398263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398263">(Aug 19 2020 at 11:58)</a>:</h4>
<p>how much work do you think the impl is?</p>



<a name="207398286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398286">(Aug 19 2020 at 11:59)</a>:</h4>
<p>I should re-read what you wrote above :)</p>



<a name="207398435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398435">(Aug 19 2020 at 12:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/213817-t-lang/topic/Promotion.20breaking.20changes/near/207398246">said</a>:</p>
<blockquote>
<p>but also that once we set it up, we can start landing code, so we could start warnings etc</p>
</blockquote>
<p>as I said I don't think there's a good way to do future-incompat warnings here... <span class="user-mention" data-user-id="124288">@oli</span> might have some ideas</p>



<a name="207398505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398505">(Aug 19 2020 at 12:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/213817-t-lang/topic/Promotion.20breaking.20changes/near/207398263">said</a>:</p>
<blockquote>
<p>how much work do you think the impl is?</p>
</blockquote>
<p>except for whatever we could maybe do for future-compat, the things I have in mind are not much work. what is unclear is if those things are good enough to keep the amount of regressions small.</p>



<a name="207398589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398589">(Aug 19 2020 at 12:02)</a>:</h4>
<p>I see</p>



<a name="207398592"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398592" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398592">(Aug 19 2020 at 12:02)</a>:</h4>
<p>that will take a few crater runs, and with the size of the crater queue right now I was going to wait before preparing those</p>



<a name="207398664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398664">(Aug 19 2020 at 12:03)</a>:</h4>
<p>ok, I have to run right now -- I think getting a PR ready for a crater run would be good, I do think an RFC makes sense, and I think I'd prefer to just try and use the new procedure because if it's too ponderous...we should fix that</p>



<a name="207398763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398763">(Aug 19 2020 at 12:04)</a>:</h4>
<p>but basically I'm trying to get to the point where we have a "project" for the various things that we're doing, and that we file "project proposals" so people can watch when new ideas come up, and we process those proposals fairly quickly (within a week or two in the triage meeting, at worst)</p>



<a name="207398791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398791">(Aug 19 2020 at 12:04)</a>:</h4>
<p>see also <a href="https://lang-team.rust-lang.org/project_groups.html">this page</a></p>



<a name="207398796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398796">(Aug 19 2020 at 12:04)</a>:</h4>
<p>sure we can test-run the procedure^^ I was going to wait for <a href="https://github.com/rust-lang/rust/pull/75502">https://github.com/rust-lang/rust/pull/75502</a> to get results before preparing the next experiment</p>



<a name="207398982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207398982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207398982">(Aug 19 2020 at 12:07)</a>:</h4>
<p>I'll also be out for now, will come back after my PhD defense</p>



<a name="207403438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207403438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207403438">(Aug 19 2020 at 12:56)</a>:</h4>
<p>I believe that creating future incompat warnings is not easy at all. Since promotion happens before borrowck when we don't know yet whether we want to promote, reducing the scope of what we promote will immediately cause breaking changes (things not having the <code>'static</code> lifetime anymore). Now what we could do is to not remove the runtime code that we promoted and instead store the local that an <code>Operand::Constant</code> would have read in case it would not have gotten promoted in the <code>mir::Constant</code>. I'm not sure how we teach borrowck to run both possibilities (promotion/no promotion) at each promotion site, but if we can figure that out, we can make the <code>no promotion</code> emit a future incompat warning as we desire). A straight forward solution would be to run borrowck twice, similar to nll compare mode, and have the first run be the regular run, and if there were no errors, run it again, but this time by treating all of those promotion constants as if they were <code>Operand::Copy</code> or <code>Operand::Move</code>.</p>



<a name="207403718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207403718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207403718">(Aug 19 2020 at 12:58)</a>:</h4>
<p>What would be an example of code which compiles both with and without promotion?</p>



<a name="207404434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207404434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207404434">(Aug 19 2020 at 13:05)</a>:</h4>
<p>Because I would be interested in the impact of always emitting a lint when we do a deprecated promotion</p>



<a name="207405407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207405407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207405407">(Aug 19 2020 at 13:14)</a>:</h4>
<p><code>let x = &amp;(1 + 2);</code> works just fine, but <code>let x: &amp;'static i32 = &amp;(1 + 2);</code> doesn't if you don't promote</p>



<a name="207405454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207405454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207405454">(Aug 19 2020 at 13:14)</a>:</h4>
<p>now this <code>'static</code> lifetime may be written somewhere completely different depending on how much inference can manage to propagate things</p>



<a name="207405524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207405524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207405524">(Aug 19 2020 at 13:15)</a>:</h4>
<p>yeah <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span> makes sense, so running borrowck twice is probably required. Thanks</p>



<a name="207418907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207418907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207418907">(Aug 19 2020 at 15:00)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> hmm so the connection to <code>const { }</code> expressions is obvious but I had forgotten about it.</p>



<a name="207721180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/207721180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#207721180">(Aug 22 2020 at 11:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/213817-t-lang/topic/Promotion.20breaking.20changes/near/207418907">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> hmm so the connection to <code>const { }</code> expressions is obvious but I had forgotten about it.</p>
</blockquote>
<p>yes, that's why I was hoping to get that RFC merged and implemented ASAP so we have something to tell affected crate authors ;)</p>



<a name="208682981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/208682981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#208682981">(Sep 01 2020 at 13:00)</a>:</h4>
<p>(I still plan to write that MCP proposal, but have been busy with other stuff, sorry.)</p>



<a name="208683074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/208683074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#208683074">(Sep 01 2020 at 13:00)</a>:</h4>
<p>Crater results came back for <a href="https://github.com/rust-lang/rust/pull/75502">https://github.com/rust-lang/rust/pull/75502</a> and they are looking good, so I propose we go ahead and merge this. Can some start the FCP process? :)</p>



<a name="208880961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/208880961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#208880961">(Sep 02 2020 at 20:13)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> done</p>



<a name="209265544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/209265544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#209265544">(Sep 07 2020 at 07:34)</a>:</h4>
<p>Crater results for <a href="https://github.com/rust-lang/rust/pull/75585">https://github.com/rust-lang/rust/pull/75585</a> came back without a single true regression. :)<br>
What's next for that PR -- does it require FCP or can it just land?</p>



<a name="212224857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/212224857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#212224857">(Oct 04 2020 at 14:09)</a>:</h4>
<p>I submitted a project proposal: <a href="https://github.com/rust-lang/lang-team/issues/58">https://github.com/rust-lang/lang-team/issues/58</a></p>



<a name="216791156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/216791156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#216791156">(Nov 15 2020 at 12:55)</a>:</h4>
<p>the next PR in the series -- removing some special case that nobody can really explain why it was added, that's rather hard to understand what it does (and why the code appears twice), that has been ported over each refactor for a few years... and that according to crater nobody even needs: <a href="https://github.com/rust-lang/rust/pull/78363">https://github.com/rust-lang/rust/pull/78363</a><br>
would be good to get FCP started. :) I am currently rebasing it to make the test suite green.</p>



<a name="216808638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/216808638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#216808638">(Nov 15 2020 at 19:13)</a>:</h4>
<p>Done.</p>



<a name="216809590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Promotion%20breaking%20changes/near/216809590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Promotion.20breaking.20changes.html#216809590">(Nov 15 2020 at 19:35)</a>:</h4>
<p>Thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>